package com.wcar.store.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.wcar.common.entity.CouponCodes;
import com.wcar.common.entity.WashCarCoupon;
import com.wcar.common.vo.Result;
import com.wcar.store.service.CouponService;
import com.wcar.store.vo.FrontUserStoreVO;
import com.wcar.store.vo.StoreVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @BelongsProject: four-wcar-idea
 * @BelongsPackage: com.wcar.store.controller
 * @Author: 李睢康
 * @CreateTime: 2024-05-28  20:03
 */
@RestController
@RequestMapping("/store/coupon")
public class CouponController {
    @Resource
    private CouponService couponService;
    @PostMapping("/api/selectCouponCodes")

    public Result<IPage> getAll(@RequestBody StoreVo storeVo){
        return couponService.getAll(storeVo);
    }
    @PostMapping("/api/insertCouponCodes")
    public Result<Integer> insert(@RequestBody CouponCodes couponCodes){
        return couponService.insert(couponCodes);
    }
    @PostMapping("/api/updataCouponCodes")
    public Result<Integer> update(@RequestBody CouponCodes couponCodes){
        return couponService.update(couponCodes);
    }
    @GetMapping("/api/deleteCouponCodes")
    public Result<Integer> delete(Integer couponId){
        return couponService.delete(couponId);
    }
    @PostMapping("/api/selectCouponByUserId")
    public Result<List<WashCarCoupon>> findCarCoupon(@RequestBody FrontUserStoreVO frontUserStoreVO){
        System.out.println(frontUserStoreVO);
        return couponService.selectCarCoupon(frontUserStoreVO);
    }
}
